from data_visualization.html_data_visualization import HtmlDataVisualization


class HeatMap(HtmlDataVisualization):
    lng_name = ""
    lat_name = ""
    value_name = ""
    lngs = []
    lats = []
    values = []
    radius = 40
    opacity = 0
    max = 100
    
    def __init__(self):
        HtmlDataVisualization.__init__(self)
        self.algorithm_name = "热力图"
        self.html_template_name = "heat_map-template.html"
        
    def setLngLatAndValueName(self, lng_name, lat_name, value_name):
        self.lng_name = lng_name
        self.lat_name = lat_name
        self.value_name = value_name
        self.lngs = self.data_source[self.lng_name].values.tolist()
        self.lats = self.data_source[self.lat_name].values.tolist()
        self.values = self.data_source[self.value_name].values.tolist()
    
    def prepareHtmlItems(self):
        HtmlDataVisualization.prepareHtmlItems(self)
        self.html_items["#lngs#"] = self.lngs
        self.html_items["#lats#"] = self.lats
        self.html_items["#values#"] = self.values
        self.html_items["#radius#"] = self.radius
        self.html_items["#opacity#"] = self.opacity
        self.html_items["#max#"] = self.max

